#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"

#include "enumlist.h"

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile(QStringLiteral("qml/EnumNameDisplay/main.qml"));
    viewer.showExpanded();

    EnumList myEnumList;
    QMetaEnum myMetaEnumA;
    QMetaEnum myMetaEnumB;
    QStringList myEnumNameListA;
    QStringList myEnumNameListB;

    myMetaEnumA = myEnumList.getMetaEnum("TestEnumA");
    myMetaEnumB = myEnumList.getMetaEnum("TestEnumB");
    myEnumNameListA = myEnumList.getEnumNameList("TestEnumA");
    myEnumNameListB = myEnumList.getEnumNameList("TestEnumB");

    QByteArray byteArray = myEnumNameListA[2].toLatin1();
    qDebug("TestEnumA index 2 name:%s, value:0x%08x", byteArray.data(), myMetaEnumA.value(2));

    qDebug("Value %d of TestEnumB's enum name is %s", 1003, myMetaEnumB.valueToKey(1003));

    return app.exec();
}
